 <#--
表格标签：用于显示列表数据。
	value：列表数据，可以是Pagination也可以是List。
-->
 <#macro grid value='' id='' action="list.do" psize='10' height='350px'>
 	<script type="text/javascript" src="${res}/ui/js/grid.js"></script>
	<div	style='overflow:auto;padding-right:15px'>
	 	<#assign i=-1/>
		<table class='table table-striped table-bordered table-hover' id='${id}_thead' style="margin-bottom:0px">
			<thead>
				<tr style="background:#f2f2f2">
					 <#nested i,true/> 
				</tr>
			</thead>
		</table>
	</div>
	
	  <#if value=''>
	  			<#assign i=-2/>
	  			<div style='height:${height};overflow-y:scroll;position:relative;border:1px solid #d9d9d9'>
				<table class="table table-striped table-bordered table-hover" style='padding-right:0px;border-size:0px' id='${id}'>
					<tbody>
						<tr style="display:none">
					 	 <#nested i,true/> 
					 	</tr>
					</tbody>
				</table>
			</div>
  			<script>
  				$(function(){
		   				var grid = new Grid('${id}','${action}');
		   				//grid.initBody();
		   				grid.initPage();
		   				grid.load();
		   				var lis = ['next','last','first','previous'] ;
		   				$("#${id}_page").find("li").each(function(idx,li){
		   						$(this).on("click",function(){
		   							grid.to(lis[idx]);
		   						});
		   				});
		   	 
			   			$("#${id}_thead").resize(function(){
			   				grid.resizeTable();
			   			});
			   		});
  			</script>
  		<#return>
  	</#if>
 	<#if value?is_sequence><#local pageList=value/><#else><#local pageList=value.result/></#if>
 	
	<div style='height:${height};overflow-y:scroll;position:relative;border:1px solid #d9d9d9'>
		<table class="table table-striped table-bordered table-hover" style='padding-right:0px;' id='${id}'>
			<tbody>
				<#list pageList as row>
					<#if row_index=0>
						<tr style="display:none">
					 	 <#nested i,true/> 
					 	</tr>
					 </#if>
					
					<#assign i=row_index has_next=row_has_next/>
					<tr>
						<#nested row,row_index,row_has_next/>
					</tr>
				</#list>
			</tbody>
		</table>
	</div>

	<#if !value?is_sequence>
 		<div class="widget-foot" id="${id}_page">
 			<div class="pagination pull-right" style="margin: -5px 5px -1px 5px ;">
 				<select style="height: 30px; width: 50px; border: 1px solid rgb(221, 221, 221);">
 					<option>10</option><option>20</option><option>30</option>
 				</select>
 			</div>
 			<ul class="pagination pull-right"style="margin: -7px 5px -1px 5px ;">
 				<li><a href="#">&gt;</a></li>
 				<li><a href="#">»</a></li>
 			</ul>
 			<div class="pagination pull-right" style="margin: -5px 5px -1px 5px ;">
 				第 <input style="height: 30px; width: 40px; border: 1px solid rgb(221, 221, 221); text-align: center;" value='1'> 页
 			</div>
 			<ul class="pagination pull-right" style="margin: -7px 5px -1px 5px ;">
	 			<li  class="disabled"><a href="#">«</a></li>
	 			<li  class="disabled"><a href="#">&lt;</a></li>
 			</ul>
 			<p style="margin: 8px;">第<span>1</span>/<span>${value.totalPage}</span>页，共<span>${value.totalCount}</span>条</p>
 		</div>
    		
		    <script>
		   			$(function(){
		   				var grid = new Grid('${id}');
		   				grid.setUrl('${action}');
		   				var lis = ['next','last','first','previous'] ;
		   				$("#${id}_page").find("li").each(function(idx,li){
		   						$(this).on("click",function(){
		   							grid.to(lis[idx]);
		   						});
		   				});
		   	 
			   			$("#${id}_thead").resize(function(){
			   				grid.resizeTable();
			   			});
			   		});
		    </script>
    </#if>
 </#macro>